import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/mobile",
    component: () => import("@/views/Mobile"),
    children: [
      {
        path: "",
        name: "Banner",
        component: () => import("@/views/Child-router/Banner"),
      },
      {
        path: "about",
        name: "MAbout",
        component: () => import("@/views/About"),
      },
    ],
  },
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue"),
  },
  {
    path: "/girl",
    name: "Girl",
  },
  {
    path: "/modify/:id",
    name: "Modify",
    component: () => import("../views/Modify"),
  },
];
console.log(process.env);
const router = new VueRouter({
  // NODE_ENV
  // process.env.NODE_ENV
  // development (本地开发环境)
  // production  (服务器产品环境)

  mode: process.env.NODE_ENV === "development" ? "history" : "hash",
  base: process.env.BASE_URL,
  routes,
});

export default router;
